<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <script src="../js/jquery-3.6.0.min.js" type="text/javascript"></script>

    <script type="text/javascript">

      $(function (){

        $("#filter").click(function (){

            // $("p:hidden").show();


            $("p:visible").hide();


        })
      })


    </script>
</head>
<body>


    <p hidden>文本1</p>
    <p>文本2</p>

    <input id="filter" type="button" value="可见性过滤">

</body>
</html>